package tracksystem;


import java.io.Serializable;

import javax.persistence.Id;

import com.googlecode.objectify.Key;
import com.googlecode.objectify.Objectify;
import com.googlecode.objectify.ObjectifyService;
import com.googlecode.objectify.annotation.Entity;

import controlsystem.Course;

@Entity
public class SchoolActivity extends Activity implements Serializable {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Id private Long id;
	
	private Key<Course> courseKey;

	private int pages;
	
	@SuppressWarnings("unused")
	private SchoolActivity(){} //nodig voor objectify
	
	public SchoolActivity(int duration,
						  String place, 
						  String description, 
						  int rating, 
						  String type,
						  String comment,
						  Course course, 
						  int pages){
		super(duration,place,description,rating,type,comment);
		this.courseKey = new Key<Course>(Course.class, course.getId());
		this.pages = pages;
	}

	public Course getCourse() {
		Objectify ofy = ObjectifyService.begin();
		
		return ofy.get(courseKey);
	}

	public int getPages() {
		return pages;
	}
	
	public Long getId(){
		return id;
	}

	
}
